﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading;
using System.Windows.Forms;

namespace WFASmartketing.REPORTES
{
    public partial class ReporteComprasRealizadasWF : Form
    {
        public ReporteComprasRealizadasWF()
        {
            InitializeComponent(); comboBox1.SelectedIndex = 0; comboBox2.SelectedIndex = 0;
        }

        private void ReporteComprasRealizadasWF_Load(object sender, EventArgs e)
        {
            // TODO: This line of code loads data into the 'proveedorDSReportes.proveedor' table. You can move, or remove it, as needed.
            this.proveedorTableAdapter.Fill(this.proveedorDSReportes.proveedor);
            // TODO: This line of code loads data into the 'ReporteComprasRealizadasDS.ReporteListaCompras' table. You can move, or remove it, as needed.
            RecaqrgarReporte();
        }
        private void RecaqrgarReporte()
        {
            string proveedor = cbxproveedor.SelectedValue.ToString();
            string estadocompra = "";
            if (comboBox1.SelectedItem.ToString().Equals("TODOS"))
            {
                estadocompra = "%%";
            }
            else { estadocompra = comboBox1.SelectedItem.ToString(); }
            string tipocompra = "";
            if (comboBox2.SelectedItem.ToString().Equals("TODOS"))
            {
                tipocompra = "%%";
            }
            else { tipocompra = comboBox2.SelectedItem.ToString(); }
            this.ReporteListaComprasTableAdapter.Fill(this.ReporteComprasRealizadasDS.ReporteListaCompras, estadocompra, tipocompra, proveedor);
            this.reportViewer1.RefreshReport();
        }
        private void button2_Click(object sender, EventArgs e)
        {
            RecaqrgarReporte();
        }
    }
}
